package com.wiwl.dao.hibernate;

import org.hibernate.SessionFactory;
import org.hibernate.criterion.Restrictions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.stereotype.Repository;

import com.wiwl.dao.interfaces.IUserDAO;
import com.wiwl.security.User;

@Repository
public class UserDAO extends GenericHibernateDAO<User> implements IUserDAO {

	@Autowired
	public UserDAO(SessionFactory sf) {
		super(sf);
	}

	@Override
	public UserDetails loadUserByUserName(String userName) {
		return this.findUniqueByCriterion(Restrictions.eq("username",userName));
	}
}
